package com.opener.common.code.assistant.gen;

import com.opener.common.code.assistant.model.Tab;
import org.springframework.util.StringUtils;

import java.util.SortedSet;
import java.util.TreeSet;

public class SearchArgsGenerator extends Generator{
    private static String Suffix = "";

    public SearchArgsGenerator(Ctx ctx, Ctx.MvcClass mvcClass) {
        super(ctx, mvcClass);
    }


    @Override
    public String createJavaString(){
        Ctx.MvcClass cls = getMvcClass();
        Tab tab = cls.getTab();

        String pkgLine = "package "+cls.getPkg()+";\n\n";
        SortedSet importLines = new TreeSet();
        importLines.add("import com.opener.web.model.common.SearchArgs;");
        StringBuffer classBody = new StringBuffer();
        classBody.append("public class "+cls.getClassName()+" extends SearchArgs{\n");
        classBody.append("}");
        String clsStr = pkgLine +
                StringUtils.collectionToDelimitedString(importLines,"\n") +"\n\n"+
                createClassDescString()+
                classBody.toString();
        return clsStr;
    }


}
